package com.hfi.ood.litejunit.v1.framework;

/**
 * @author ChangLiang
 * @date 2020/5/26
 */
public class TestFailure {

    Test failedTest;

    Throwable thrownException;

    /**
     * Constructs a TestFailure with the given test and exception.
     */
    public TestFailure(Test failedTest, Throwable thrownException) {
        this.failedTest= failedTest;
        this.thrownException= thrownException;
    }
    /**
     * Gets the failed test.
     */
    public Test failedTest() {
        return failedTest;
    }
    /**
     * Gets the thrown exception.
     */
    public Throwable thrownException() {
        return thrownException;
    }
    /**
     * Returns a short description of the failure.
     */
    @Override
    public String toString() {
        StringBuffer buffer= new StringBuffer();
        buffer.append(failedTest+": "+thrownException.getMessage());
        return buffer.toString();
    }
}
